/**
 *******************************************************************************
 * @file comm_ttl.h
 * @author .ISS_AUTO (hudandan@issauto.com)
 * @date 2024-06-07  1. Base version.
 *       2024-09-04  1. 更新cli模块.
 *
 * @brief This file is interfaces for user communication.
 *
 * @copyright Copyright (c) 2024 ISSAUTO TECH Co., Ltd. All rights reserved.
 *
 *******************************************************************************
 */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USER_COMMON_H
#define __USER_COMMON_H

#ifdef __cplusplus
extern "C" {
#endif


/** @addtogroup Application Driver Layer Module Configuration(Only For Debug)
  * @{
  */
#define RS485_CLI_ENABLE        (1U) //!< RS485通道，自定义CLI使能配置

/**
  * @}
  */

/* Exported Includes ---------------------------------------------------------*/
#include "main.h"

#if (RS485_CLI_ENABLE)
#include "hcli.h"
#endif

/* Private typedef ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Uart Driver Config */

/* Commun Config */
#define COMM_CHANNEL_TTL             UART_CHANNEL_TTL
#define COMM_485_RX_BUF_SIZE         (1U << 7) //!< UART RX buffer size, must be a multiple of 2

/* Exported variables --------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
extern unsigned int RS485_Transmit_Data(const void *pBuf, uint32_t pBufLen);
extern unsigned int RS485_Read_Data(void *buf, unsigned int len);

#if (RS485_CLI_ENABLE)
extern hcli_obj_t *rs485cli_obj_get(void);
extern int rs485cli_cmds_add(hcli_cmd_t *cmd, unsigned int n);
extern int rs485cli_cmds_del(hcli_cmd_t *cmd, unsigned int n);
#endif

/* Exported functions --------------------------------------------------------*/
void Comm_DeInit(void);
void Comm_Init(void);
void Comm_Handle(void);

#ifdef __cplusplus
}
#endif

#endif /* __USER_COMMON_H */

/* END OF FILE ---------------------------------------------------------------*/
